package com.yjq.diy;

import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.Signature;
import org.aspectj.lang.annotation.After;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;

@Aspect
public class DIY {
    @Before("execution(* com.yjq.service.UserServiceImpl.*(..))")
    public void before(){
        System.out.println("===前置环绕通知===");
    }
    @After("execution(* com.yjq.service.UserServiceImpl.*(..))")
    public void after(){
        System.out.println("===后置环绕通知===");
    }

    @Around("execution(* com.yjq.service.UserServiceImpl.*(..))")
    public void Around(ProceedingJoinPoint proceedingJoinPoint) throws Throwable {
        System.out.println("环绕前");
        //获得签名
        Signature signature = proceedingJoinPoint.getSignature();
        System.out.println("signature"+signature);

        Object proceed = proceedingJoinPoint.proceed();
        System.out.println("环绕后");
    }
}
